using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.Drawing;

namespace RideMe.Presentation
{
    public class FontComboControl : ComboBox 
    {

        /// <summary>
        /// Initializes a new instance of the <see cref="T:FontComboControl"/> class.
        /// </summary>
        public FontComboControl()
        {
            this.DropDownStyle = ComboBoxStyle.DropDownList;

            LoadFonts();
            
            this.SelectedIndex = 0;
        }

        /// <summary>
        /// Loads the fonts.
        /// </summary>
        private void LoadFonts()
        {
            try
            {
                FontFamily[] famlies = FontFamily.GetFamilies(this.CreateGraphics());

                for (int i = 0; i < famlies.Length; i++)
                {
                    this.Items.Add(famlies[i].Name);
                }
            }
            catch { }
        }
    }
}
